package com.itheima.a01mymap;

import java.util.Objects;

public class Student {
    private String nname;
    private int age;

    public Student() {
    }

    public Student(String nname, int age) {
        this.nname = nname;
        this.age = age;
    }

    public String getNname() {
        return nname;
    }

    public void setNname(String nname) {
        this.nname = nname;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Student student)) return false;
        return getAge() == student.getAge() && Objects.equals(getNname(), student.getNname());
    }

    @Override
    public int hashCode() {
        return Objects.hash(getNname(), getAge());
    }

    @Override
    public String toString() {
        return "Student{" +
                "nname='" + nname + '\'' +
                ", age=" + age +
                '}';
    }
}
